[XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate
authorJimi Xenidis <jimix@watson.ibm.com>
Sun, 17 Dec 2006 17:40:10 +0000 (12:40 -0500)
committerJimi Xenidis <jimix@watson.ibm.com>
Sun, 17 Dec 2006 17:40:10 +0000 (12:40 -0500)
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %B0N%24%DB0%8F%22%15%C6%BA%FA%F3X%D1%C1%0D%A7%9F%24O

xen/arch/powerpc/powerpc64/ppc970.c
xen/arch/powerpc/setup.c
xen/arch/powerpc/sysctl.c
xen/include/asm-powerpc/processor.h

index 9b8ad111bad1d51e69be0b51be51e64ba5a9e2d2..64a05571f6f92360348370a605503d2d2cfa8b25 100644 (file)
@@ -129,7 +129,6 @@ unsigned int cpu_extent_order(void)
     return log_large_page_sizes[0] - PAGE_SHIFT;
 }
 
-
 /* This is more a platform thing than a CPU thing, but we only have
  * one platform now */
 int cpu_io_mfn(ulong mfn)
@@ -142,6 +141,12 @@ int cpu_io_mfn(ulong mfn)
     return 0;
 }
 
+int cpu_threads(int cpuid)
+{
+    return 1;
+}
+
+
 static u64 cpu0_hids[6];
 static u64 cpu0_hior;
 
index c22e6712bbf6f4c4f8860ff44da09a82c102a9c3..2392cd9650297c9af3c70009d0d4de3c387593a3 100644 (file)
@@ -179,9 +179,6 @@ static void __init start_of_day(void)
     set_current(idle_domain->vcpu[0]);
     idle_vcpu[0] = current;
 
-    /* for some reason we need to set our own bit in the thread map */
-    cpu_set(0, cpu_sibling_map[0]);
-
     initialize_keytable();
     /* Register another key that will allow for the the Harware Probe
      * to be contacted, this works with RiscWatch probes and should
@@ -247,6 +244,19 @@ static int kick_secondary_cpus(int maxcpus)
     int cpuid;
 
     for_each_present_cpu(cpuid) {
+        int threads;
+        int i;
+        
+        threads = cpu_threads(cpuid);
+        for (i = 0; i < threads; i++)
+            cpu_set(i, cpu_sibling_map[cpuid]);
+
+        /* For now everything is single core */
+        cpu_set(0, cpu_core_map[cpuid]);
+
+        numa_set_node(cpuid, 0);
+        numa_add_cpu(cpuid);
+
         if (cpuid == 0)
             continue;
         if (cpuid >= maxcpus)
@@ -257,9 +267,6 @@ static int kick_secondary_cpus(int maxcpus)
         /* wait for it */
         while (!cpu_online(cpuid))
             cpu_relax();
-
-        numa_set_node(cpuid, 0);
-        numa_add_cpu(cpuid);
     }
 
     return 0;
index 5d25d696fd721ae01fe80544d2ec48db62ca949a..3b25b5f89bf44b8d3316911c65d35d3640d405c3 100644 (file)
@@ -41,9 +41,13 @@ long arch_do_sysctl(struct xen_sysctl *sysctl,
     {
         xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
 
-        pi->threads_per_core = 1;
-        pi->cores_per_socket = 1;
-        pi->sockets_per_node = 1;
+        pi->threads_per_core =
+            cpus_weight(cpu_sibling_map[0]);
+        pi->cores_per_socket =
+            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
+        pi->sockets_per_node = 
+            num_online_cpus() / cpus_weight(cpu_core_map[0]);
+
         pi->nr_nodes         = 1;
         pi->total_pages      = total_pages;
         pi->free_pages       = avail_domheap_pages();
index 50d544b9eabf300ecf1f0bb9c28a7666c441edf6..3a4ad0426036ac9e61ba934429129d0a68daa658 100644 (file)
@@ -125,6 +125,7 @@ extern uint cpu_large_page_orders(uint *sizes, uint max);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);
 extern int cpu_io_mfn(ulong mfn);
+extern int cpu_threads(int cpuid);
 extern void save_cpu_sprs(struct vcpu *);
 extern void load_cpu_sprs(struct vcpu *);
 extern void flush_segments(void);